package com.yuexun.dhdoctor.module.mythings.model.impl;


import com.yuexun.dhdoctor.base.BaseEntity;
import com.yuexun.dhdoctor.base.bean.model.HelpFileBean;
import com.yuexun.dhdoctor.module.mythings.api.ThingApi;
import com.yuexun.dhdoctor.module.mythings.bean.AnnualLeaveBean;
import com.yuexun.dhdoctor.module.mythings.bean.BackMemberData;
import com.yuexun.dhdoctor.module.mythings.bean.FeedBackResultBean;
import com.yuexun.dhdoctor.module.mythings.bean.FlowMemberData;
import com.yuexun.dhdoctor.module.mythings.bean.SignDtlData;
import com.yuexun.dhdoctor.module.mythings.bean.TaskListData;
import com.yuexun.dhdoctor.module.mythings.bean.TaskMainBean;
import com.yuexun.dhdoctor.module.mythings.bean.TypeData;
import com.yuexun.dhdoctor.module.mythings.bean.WhiteData;
import com.yuexun.dhdoctor.module.mythings.model.IThingModel;
import com.yuexun.dhdoctor.util.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by work-jx on 2016/8/31.
 */
public class ThingModel implements IThingModel {
    private ThingApi api;

    //记录Log
//    private final Logger log = ProUtil.getLogger(LoginModel.class);

    public ThingApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(ThingApi.class);
        }
    }
    @Override
    public Observable<TaskListData> getOtherTaskDatas(Map<String, String> praise) {
        api = ApiInstance();
        return api.getOtherTaskDatas(praise);
    }

    @Override
    public Observable<TaskListData> getCopyTaskDatas(Map<String, String> praise) {
        api = ApiInstance();
        return api.getCopyTaskDatas(praise);
    }

    @Override
    public Observable<FeedBackResultBean> approvalTask(Map<String, String> praise) {
        api = ApiInstance();
        return api.approvalTask(praise);
    }

    @Override
    public Observable<BaseEntity<SignDtlData>> getDtlList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getDtlList(praise);
    }

    @Override
    public Observable<WhiteData> whiteList(Map<String, String> praise) {
        api = ApiInstance();
        return api.whiteList(praise);
    }

    @Override
    public Observable<BaseEntity<TypeData>> getTypeDatas(Map<String, String> praise) {
        api = ApiInstance();
        return api.getTypeDate(praise);
    }

    @Override
    public Observable<HelpFileBean> getHelpFile(Map<String, String> params) {
        api = ApiInstance();
        return api.getHelpFile(params);
    }

    @Override
    public Observable<BaseEntity<FlowMemberData>> getFlowMember(Map<String, String> params) {
        api = ApiInstance();
        return api.getFlowMember(params);
    }

    @Override
    public Observable<BaseEntity<BackMemberData>> getFlowType(Map<String, String> params) {
        api = ApiInstance();
        return api.getFlowType(params);
    }

    @Override
    public Observable<BaseEntity<TaskMainBean>> inquireTaskCloneDetail(Map<String, String> params) {
        api = ApiInstance();
        return api.inquireTaskCloneDetail(params);
    }

    @Override
    public Observable<BaseEntity<AnnualLeaveBean>> inquireTaskOfZdLeaveDays(Map<String, String> params) {
        api = ApiInstance();
        return api.inquireTaskOfZdLeaveDays(params);
    }
}
